package com.ithuameng.admin.app.system.model;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

/**
 * 流水号数据表
 *
 * @author ithuameng
 */
@Data
@TableName("t_seq_data")
@EqualsAndHashCode(callSuper = false)
public class SequenceData extends BaseId<Long> {

	private static final long serialVersionUID = -8890124656777783846L;
	
	public static final String PREFIX = "prefix";
	
	public static final String PRECODE = "precode";

	public static final String CREATE_TIME = "create_time";

	public static final String UPDATE_TIME = "update_time";

	@TableId(type = IdType.AUTO)
	private Long id;

	/**
	 * 前缀
	 */
	private String prefix;

	/**
	 * 前部分（含前缀）
	 */
	private String precode;

	/**
	 * 当前值
	 */
	private Long currentVal;

	/**
	 * 创建时间
	 */
	@TableField(value = CREATE_TIME, fill = FieldFill.INSERT)
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private LocalDateTime createTime;

	/**
	 * 更新时间
	 */
	@TableField(value = UPDATE_TIME, fill = FieldFill.UPDATE, update = "NOW()")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private LocalDateTime updateTime;
}